package com.itheima.Service.imple;

import com.itheima.Service.EmpLogService;
import com.itheima.entity.EmpLog;
import com.itheima.mapper.EmpLogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class EmpLogServiceImpl implements EmpLogService {
    @Autowired
    private EmpLogMapper empLogMapper;
    //插入操作日志
    //@Transactional开启默认事务，有则加入无则创建
    @Transactional(propagation = Propagation.REQUIRES_NEW)//开启新事物
    @Override
    public void insertLog(EmpLog  empLog) {
        empLogMapper.insert(empLog);
    }
}
